/*
 
 dst DCD 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

 2.内存数据区定义如上。要求将数据从源数据区复制到目标数据区。
   复制时，以4个字为单位进行。对于最后所剩不足4个字的数据，以字为单位进行复制

 */

        area add, code,readonly
        num EQU 18
        entry

start
        ldr r0, =src
        ldr r1, =dst
        mov r2, #num
        mov sp, #0x40

blockcopy
	movs r3, r2, lsr#2
	beq copywords
	stmfd sp!, {r4-r7}

octcopy
	ldmia r0!, {r4-r7}
	stmia r1!, {r4-r7}
	subs r3, r3, #1
	bne octcopy
	ldmfd sp!, {r4-r7}

copywords
	ands r2, r2, #3
	beq stop

wordcopy
	ldr r3, [r0], #4
	str r3, [r1], #4
	subs r2, r2, #1
	bne wordcopy

stop
	mov r0, #0x18
	ldr r1, =0x20026
	swi 0x123456

stopend
	b stopend

area blockdata, data, readwrite
src	dcd 1,2,3,4,5,6,7,8
	dcd 1,2,3,4,5,6,7,8
	dcd 1,2 12

dst	dcd 0,0,0,0,0,0,0,0
	dcd 0,0,0,0,0,0,0,0
	dcd 0,0

end
        
        
